package com.kob.backend.service.impl.favorite;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kob.backend.mapper.FavoriteMapper;
import com.kob.backend.pojo.favorite;
import com.kob.backend.service.favorite.FavoriteAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
@Service
public class FavoriteAddServiceImpl implements FavoriteAddService {
  @Autowired
  private FavoriteMapper favoriteMapper;
    @Override
    public Map<String, String> addfavorite(Integer userid, Integer productid) {
        //QueryWrapper queryWrapper = new QueryWrapper();
        Map<String, String> map = new HashMap<>();
        //queryWrapper.eq("userid",userid);
        //queryWrapper.eq("productid",productid);
        //if(favoriteMapper.selectList(queryWrapper)==null) {
            favorite this_favorite = new favorite(userid,productid);
            favoriteMapper.insert(this_favorite);
            map.put("error_message", "success");
        //}
        return map;
    }
}
